<style type="text/css">
    .table {color: #4d4d4d;

    }
    .namablkg{ width: 150px; height: auto; color: #4d4d4d; border: 1px solid #d1d1d1; border-radius: 4px; height: 25px;  }
    .titles{ width: 600px; padding-left: 20px; height: 30px; padding-top: 10px; background-color: #CA0000; color: #fff; border-radius: 5px;}
#titlemerah1 { width:615px; margin-right:20px; color:#fff; padding-left:10px; height:30px; margin-left:-7px; padding-top:5px;  background:#CA0000;   }
</style>       


<script type = "text/javascript">
    function checkTheBox() {
        var flag = 0;
        for (var i = 0; i< 1; i++) {
            if(document.myform["syarat"].checked){
                flag ++;
            }
        }
        if (flag != 1) {
            alert ("Anda harus cek membaca syarat dan ketentuan");
            return false;
        }
        return true;
    }
    
    function namadepan(value){
        document.myform.nama_d_dk.value = value;
    }
    
    function namabelakang(value){
        document.myform.nama_b_dk.value = value;
    }
    
    function kode_negara(value){
        document.myform.kode_negara_s_dk.value = value;
    }
    
    function title(value){
        document.myform.title_dk.value = value;
    }
    
</script>


<!-- Halaman Kiri -->
<form name="myform" method="POST" action="<?php echo base_url() ?>costumers/booking_create" onsubmit="return checkTheBox();">
    <div id="blokdata">

        <div id="stat"><b>Book Tiket</b> </div>
        <br /><br />
        <div id="headertiket">
            <b><font color="black">Detail Itinerary</b></font><br />
            <table class="table table-hover table-bordered" style="width:610px;">
                <thead class="table-head">
                    <tr>
                        <td><strong>Flight</strong></td>
                        <td><strong>Depart</strong></td>
                        <td><strong>Arrive</strong></td>
                        <td><strong>Price</strong></td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td ><img src="<?php echo base_url() ?>image/icon_<?php echo strtolower($detail['airlines_name']) ?>_2.jpg"/><font color="#4d4d4d"><?php echo $detail['flight_number'] ?></td>
                        <td><font color="#4d4d4d"><?php echo get_airport($detail['from']) . ' ' . $detail['date'] . ' ' . $detail['simple_departure_time'] ?></td>
                        <td><font color="#4d4d4d"><?php echo get_airport($detail['to']) . ' ' . $detail['date'] . ' ' . $detail['simple_arrival_time'] ?></td>
                        <td><font color="#4d4d4d">IDR <?php echo get_money($detail['price_value']) ?></td>
                    </tr>
                </tbody>
            </table>

           
            <b><font color="black">Summary</b></font><br />
            <table class="table table-hover table-bordered" style="width:610px;">
                <thead class="table-head">
                    <tr>
                        <td><strong>Adult</strong></td>
                        <td><strong>Child</strong></td>
                        <td><strong>Infant</strong></td>
                        <td><strong>Total Price</strong></td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><font color="#4d4d4d"><?php echo $detail['adult'] . ' x ' . get_money($detail['price_adult']) ?></td>
                        <td><font color="#4d4d4d"><?php echo $detail['child'] . ' x ' . get_money($detail['price_child']) ?></td>
                        <td><font color="#4d4d4d"><?php echo $detail['infant'] . ' x ' . get_money($detail['price_infant']) ?></td>
                        <?php $human = $detail['adult'] + $detail['child'] ?>
                        <?php $infant = $detail['infant'] * $infant_price ?> 
                        <?php $total = $detail['price_value'] * $human + $infant ?>

                        <td><font color="#4d4d4d">IDR <?php echo get_money($detail['price_value']) ?></td>

                        <?php echo form_hidden('qty', $human) ?>
                        <?php echo form_hidden('total1', $detail['price_value']) ?>
                    </tr>
                </tbody>
            </table>
         
        </div>

        <?php if (!$detail2 == null): ?>
            <div id="headertiket">
                <b>Detail Itinerary 2</b><br />
                <table class="table table-hover table-bordered">
                    <thead class="table-head">
                        <tr>
                            <td><strong>Flight</strong></td>
                            <td><strong>Depart</strong></td>
                            <td><strong>Arrive</strong></td>
                            <td><strong>Class</strong></td>
                            <td><strong>Price</strong></td>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td><?php echo get_airlines($detail2['id_maskapai']) ?> <?php echo $detail2['flight'] ?></td>
                            <td><?php echo get_airport($detail2['from']) . ' ' . get_date($detail2['date']) . ' ' . $detail['depart'] ?></td>
                            <td><?php echo get_airport($detail2['to']) . ' ' . get_date($detail2['date']) . ' ' . $detail['arrives'] ?></td>
                            <td><?php echo $detail2['class'] ?></td>
                            <td><?php echo get_money($detail2['price']) ?></td>
                        </tr>
                    </tbody>
                </table>

                <hr color="#bf0d31" />
                <b>Summary 2</b><br />
                <table class="table table-hover table-bordered">
                    <thead class="table-head">
                        <tr>
                            <td><strong>Adult</strong></td>
                            <td><strong>Child</strong></td>
                            <td><strong>Infant</strong></td>
                            <td><strong>Total Price</strong></td>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td><?php echo $detail['adult'] . ' x ' . number_format($detail2['adult_price'], 0, ",", ",") ?></td>
                            <td><?php echo $detail['child'] . ' x ' . number_format($detail2['child_price'], 0, ",", ",") ?></td>
                            <td><?php echo $detail['infant'] . ' x ' . number_format($detail2['infant_price'], 0, ",", ",") ?></td>
                            <?php $human_p = $detail2['adult'] + $detail2['child'] ?>
                            <?php $infant_p = $detail2['infant'] * $infant_price ?>
                            <?php $total_p = $detail2['price'] * $human_p + $infant_p ?>

                            <td><?php echo number_format($total_p, 0, ",", ",") ?></td>

                            <?php echo form_hidden('id_jadwal2', $detail2['id_jadwal']) ?>
                            <?php echo form_hidden('qty', $human) ?>
                            <?php echo form_hidden('total2', $total_p) ?>
                        </tr>
                    </tbody>
                </table>
                <hr color="#bf0d31" />
            </div>
            <br /> 
        <?php endif ?>

        <?php if (!$detail2 == null): ?>
            <!--            <h3>Total</h3>
                        <p>
                            Keberangkatan = <?php echo $total ?> <br />
                            Pulang = <?php echo $total_p ?> <br />
                            Total = <?php echo $total + $total_p ?>
                        </p>-->
        <?php endif ?>


        <div id="perhatian">
            <b>catatan:</b><br />
            <font color="#bf0d31">* harga TBA adalah harga yang baru dapat di peroleh setelah proses booking selesai<br>
            * Harga yang tertera diatas hanya sebagai acuan, bila ada perbedaan  harga antara harga diatas dengan harga pada bukti 
            booking anda, maka yang digunakan adalah harga yang tertera  pada bukti booking. </font>
        </div>
<br>

        <div id="perhatian">

            <font color="#4d4d4d">*Lengkapi seluruh data di bawah<br />
            *Pastikan nama penumpang sesuai dengan kartu identitas  (KTP/SIM) atau passport<br />
            *Penumpang harus menunjukkan kartu identitas pada saat check-in<br />
            *Nama penumpang tidak dapat di rubah setelah booking selesai. <br /></font>
        </div>

        <br />
        <div style="float:left; width:610px;">

            <?php
            //adult
            $title = array('Mr' => 'Mr', 'Mrs' => 'Mrs', 'Ms' => 'Ms');
            $adult_count = $detail['adult'];
            $child_count = $detail['child'];
            $infant_count = $detail['infant'];
            $code = get_code(6);
            //child
            $title_child = array('Mr' => 'Mr', 'Ms' => 'Ms');
            for ($i = 1; $i <= 31; $i++) {
                $tanggal[$i] = $i;
            }
            for ($i = $ymin_c; $i <= $ymax_c; $i++) {
                $tahun[$i] = $i;
            }

            $bulan = array("January", "February", "Maret", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "Desember");
            
            //infant
            for ($i = $ymin_i; $i <= $ymax_i; $i++) {
                $tahun_infant[$i] = $i;
            }

            $orangtua = array_map(function($n) {
                        return sprintf("Dewasa $n", $n);
                    }, range(1, $detail['adult']));
            ?>


            <?php include('adult.php') ?>
            <?php include('child.php') ?>
            <?php include('infant.php') ?>
            <div id="titlemerah1"><p align="left">Informasi Kontak yang Dapat Dihubungi</p></div>
            <table class="table" style="font-size='2'" > 
                <div style="float:left; width:610px;">
                    <tr>
                        <td colspan="5">
                            

                        <!--                        <input type="checkbox" /> Nama kontak sama dengan nama penumpang-->
                        </td>
                    </tr>
                    <table class="table" style="width:610px;">
                        <tr>
                            <td>Nama</td>
                            <td>Title<br /><?php echo form_dropdown('title_dk', $title, '', "class='span1'") ?></td>
                            <td>Nama Depan <small style="font-size:8px; color:#bf0d31">*)Max 12 Char</small><br /><?php echo form_input('nama_d_dk', '', "class='span2'") ?></td>
                            <td >Nama Belakang <small style="font-size:8px; color:#bf0d31">*)Max 12 Char</small><br /><?php echo form_input('nama_b_dk', '', "class='span2'") ?></td>
                        </tr>

                        <tr>
                            <td></td>
                            <td>Kode Negara<br />+ &nbsp;<?php echo form_input('kode_negara_dk', '', "onkeyup=\"kode_negara(this.value)\" class='span1' maxlength='2' style='margin-top:-3px;'") ?></td>
                            <!--<td>Kode Wilayah<br /><?php // echo form_input('kode_wilayah_dk', '', "class='span1' maxlength='2' style='margin-top:-3px;'") ?></td>-->
                            <td colspan="2">No Telp<br /><?php echo form_input('nomor_telp_dk', '', "class='span2' style='margin-top:-3px;'") ?></td>
                        </tr>


                        <tr>
                            <td></td>
                            <td colspan="4"><font color="#bf0d31"><b>*Penting :</b> Airlines akan memberikan info ke no telp ini bila
                                <br />ada penundaan / pembatalan penerbangan</font></td>
                        </tr>

                        <tr>
                            <td>No Telp penumpang</td>
                            <td >Kode negara<br />+ &nbsp;<?php echo form_input('kode_negara_s_dk', '', "class='span1' style='margin-top:-3px;'") ?></td>
                            <td colspan="2">No Telp kantor / handphone penumpang lainnya (Boleh diisi sama)<br /><?php echo form_input('no_telp_selular_dk', '', "class='span2' style='margin-top:-3px;'") ?></td>
                        <tr></tr>
                        </tr>
                        <tr>
                            <td>Catatan</td>
                            <td colspan="4"><?php echo form_input('catatan_dk', '', "class='span6'") ?></td>
                            <?php echo form_hidden('code', $code) ?>
                        </tr>

                    </table>
                    <b><font color="#4d4d4d">Perjanjian Pembeli</b></font><br />
                    <?php echo get_check(0, 'syarat'); ?>
                    <font color="#4d4d4d">saya telah membaca dan menyutujui<br /> </font><?php echo anchor('contents/show/1', 'Syarat', array('target' => '_blank')) ?><font color="#4d4d4d"> dan ketentuan</font><br />
                    <?php echo form_hidden('booking1', $detail) ?>
                    <?php if (!$detail2 == null): ?>
                        <?php echo form_hidden('booking2', $detail2) ?>
                    <?php endif ?>
                    <?php echo form_submit('submit', 'Finalisasi Booking', "class='btn'") ?>
                </div>
        </div>
</form>
<!-- tutup halaman kiri-->  
